package design.mode.singleton;

import java.util.concurrent.atomic.AtomicLong;

/**
 * <p>枚举式单例写法在静态块中就对INSTANCE进行了赋值，是饿汉式单例写法的实现。<p/>
 */
public enum EnumSingleton {
    INSTANCE;
    private static AtomicLong id  = new AtomicLong(0);

    public long getId(){
        return id.incrementAndGet();
    }
}
